#include <bits/stdc++.h>
using namespace std;

int t, n, lx, rx;
const int MOD = 998244353;
typedef long long LL;

const int inv2 = (MOD + 1) / 2;



int f(int n, int k) {
    static int a[1000];
    int ans = 0;
    for (int i=1; i<=k; ++i) {
        a[i] = (i <= n%k) + n/k;    
        ans += (n - a[i]) * a[i];
    }
    
    return ans/2;
}

int brutalforce(int n, int l, int r) {
    int ans = 0;
    for (int i=l; i<=r; ++i)
        ans += f(n, i);
    return ans; 
}

LL sum(int a, int b, int d) {
    if (a > b) swap(a, b);
    LL res = 1LL * (a+b) * ((b-a) / d + 1) /2 % MOD;
    return res;
}

int main(int argc, char const *argv[])
{

    // printf("%d\n", f(3, 2));
    int t;
    scanf("%d", &t);
    // int ans = 0;
    for (int kk=0; kk<t; ++kk) {
        scanf("%d%d%d", &n, &lx, &rx);
        LL ans = 1LL * n * n % MOD * (rx-lx+1) % MOD;
        LL ans2 = 0;
        for (int l=lx, r, v; l<=rx; l=r+1) {
            v = n / l; r = min(n / v, rx);

            int a = n % l, b = n % r, d = v;
            assert((b-a) % d == 0);
            
            LL s = sum(a, b, d), s2 = sum(l, r, 1);


            ans2 = (ans2 + ((s2 - s) * v % MOD * v + s * (v + 1) % MOD * (v + 1))) % MOD;
            
            // printf("l=%d, r=%d, v=%d, s=%lld, s2=%lld, a=%d, b=%d, d=%d, ans2=%lld\n", l, r, v, s, s2, a, b, d, ans2);
        }
        // printf("%lld %lld\n", ans, ans2);
        ans = ((ans - ans2) % MOD + MOD) % MOD;
        printf("%lld\n", ans * inv2 % MOD);
    }
    // printf("%d\n", ans);
    return 0;
}
